package ve.lm.hrms_cy.Controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import ve.lm.hrms_cy.Entity.Bill;
import ve.lm.hrms_cy.Entity.Request.BillQueryRequest;
import ve.lm.hrms_cy.Entity.Request.SalaryQueryRequest;
import ve.lm.hrms_cy.Entity.Response.ResponseEntityCY;
import ve.lm.hrms_cy.Entity.Salary;
import ve.lm.hrms_cy.Service.MoneyManagerService;

@RestController
@RequestMapping("/moneyManager")
public class MoneyManagerController {

    @Autowired
    MoneyManagerService moneyManagerService;

    @PostMapping("/salaryManager/addSalary")
    public ResponseEntityCY<Boolean> addSalary(@RequestBody Salary salary){

        return moneyManagerService.addSalary(salary);

    }

    @PostMapping("/salaryManager/findSalaryByPage")
    public ResponseEntityCY<IPage<Salary>> addSalary(@RequestBody SalaryQueryRequest salaryQueryRequest){

        return moneyManagerService.findSalaryByPage(salaryQueryRequest);

    }

    @PostMapping("/salaryManager/updateSalary")
    public ResponseEntityCY<Boolean> updateSalary(@RequestBody Salary salary){

        return moneyManagerService.updateSalary(salary);

    }

    @PostMapping("/salaryManager/deleteOrRecoverSalary")
    public ResponseEntityCY<Boolean> deleteOrRecoverSalary(@RequestParam("id") Long id , @RequestParam("isDelete") Boolean isDelete){

        return moneyManagerService.deleteOrRecoverSalary(id , isDelete);

    }

    @PostMapping("/billManager/addBill")
    public ResponseEntityCY<Boolean> addBill(@RequestBody Bill bill){

        return moneyManagerService.addBill(bill);

    }

    @PostMapping("/billManager/findBillByPage")
    public ResponseEntityCY<IPage<Bill>> addBill(@RequestBody BillQueryRequest billQueryRequest){

        return moneyManagerService.findBillByPage(billQueryRequest);

    }

    @PostMapping("/billManager/updateBill")
    public ResponseEntityCY<Boolean> updateBill(@RequestBody Bill bill){

        return moneyManagerService.updateBill(bill);

    }

    @PostMapping("/billManager/deleteOrRecoverBill")
    public ResponseEntityCY<Boolean> deleteOrRecoverBill(@RequestParam("id") Long id ,@RequestParam("isDelete") Boolean isDelete){

        return moneyManagerService.deleteOrRecoverBill(id , isDelete);

    }

}
